package org.springblade.modules.admin.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description 维保业务/梯联网生效状态 (对应blade_estate_elevator表)
 * @Author ysq
 * @Date 2022/5/27
 **/
@Getter
@AllArgsConstructor
public enum EffectiveStatusEnum {

	NO_OPEN(0, "未开通"),

	WAIT_EFFECT(1, "待生效"),

	EFFECTED(2, "生效中"),

	LOSE_EFFICACY(3, "已失效");

	final int status;

	final String name;

	/**
	 * 根据status获取枚举name值
	 * @param status 枚举status
	 * @return name值
	 */
	public static String getName(Integer status){
		if (status == null) {
			return null;
		}

		EffectiveStatusEnum[] values = EffectiveStatusEnum.values();
		for(EffectiveStatusEnum statusEnum :values){
			Integer enumStatus = statusEnum.getStatus();
			if(enumStatus.equals(status)){
				return statusEnum.getName();
			}
		}
		return null;
	}
}
